package com.hkd.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author ：陈奕安（3048279304@qq.com）
 * @date ：Created in 2025/5/4 17:52
 * @description：
 * @modified By：
 * @version:
 */
public class DoRegister extends HttpServlet {
    private static final long serialversionUID=1l;
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        request.setCharacterEncoding("UTF-8");
        String uname=request.getParameter("uname");
        String pwd=request.getParameter("pwd");
        String[] cb=request.getParameterValues("cb");
        String sex=request.getParameter("sex");
        PrintWriter out = response.getWriter();
        out.println("<heml><body>");
        out.println("<h1>注册信息</h1>");
        out.println("<p>用户名："+uname+"</p>");
        out.println("<p>密码："+pwd+"</p>");
        out.println("<p>爱好：");
        if (cb!=null){
            for (String hobby:cb)
            {
                out.println(hobby+" ");
            }
            out.println("</p>");
            out.println("<p>性别："+sex+"</p>");
            out.println("</boby></html>");
        }
    }
}